<template>
  <div class="contents">
    <PanelTitle title="指标推荐" />
    <div class="mt" style="height: 20vh;">
    <table >
      <thead>
        <tr>
          <th>指标类型</th>
          <th>指标名称</th>
          <th>种植品种</th>
          <th>指标说明</th>
        </tr>
      </thead>
      <tbody>
        <template v-for="(item, index) in data">
          <tr v-for="(s, i) in item.stepList">
            <th :rowspan="item.stepList.length" v-if="i ==0">{{ item.type == 1 ? '土壤指标' : '环境指标' }}</th> 
            <td>{{ s.name }}</td>
            <td>{{s.norm}}</td>
            <td>{{ s.remark }}</td>
          </tr>
          </template>
      </tbody>
    </table>
  </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import echarts from "@/components/echarts";
import PanelTitle from "../../component/PanelTitle.vue";
import http from "@/api/http";
import { env } from "@/utils/env";
const data = ref([])
onMounted(async () => {
  let res = await http({
    url: env.VITE_ZHER_DATA_CENTER + "/gap/promotion/index/recommend/classify",
    method: "get",
  });
  
  data.value = res.data
});
</script>

<style scoped lang="scss">
.contents {
  background: linear-gradient(to bottom,
      rgba(5, 79, 99),
      rgba(5, 79, 99, 0.1),
      rgba(5, 79, 99));
  border-radius: vh(8);
  border: vh(1) solid rgba(6, 112, 180, 1);

  .mt {
    margin-top: vh(-30);
  }
}

table,
th,
td {
  border: vh(1) solid #2cd7bc;
  border-collapse: collapse;

  font-family: Source Han Sans CN;
  font-weight: 500;
  font-size: vh(10);
  text-align: center;
}

table {
  width: vw(344);
  height: vh(155);
  margin: 0 auto;
}

th {
  color: #fff;
  background: rgba(50, 200, 167, 0.45);
  min-width: vw(60);
  line-height: vh(20);
  padding: vh(4) 0;
}

td {
  color: #2cd7bc;
  line-height: vh(14);
  padding: vh(4) 0;
}
</style>